<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Client Data Store Example</title>
	<script src="/socket.io/socket.io.js"></script>
	<script>
		window.onload = function() {
			// connect socket
			var socket = io.connect();
			
			var name = prompt('이름을 입력해 주세요.', '이름');
			
			// send name
			socket.emit('setname', name);
			
			// get data
			socket.on('responsename', function(name) {
				alert(name);
			});
			
			// getname event handler
			document.getElementById('getname').onclick = function() {
				socket.emit('getname');
			};
		};
	</script>
</head>
<body>
	<button id='getname'>이름 가져오기</button>
</body>
</html>